@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection

@section('content')
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/css/vulslist.css">
    <link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/layui/css/layui.css">
    <!-- Main content -->
    <section class="content">
        @isset($item)
            <div class="row">
                <div class="col-xs-12">
                    <div class="">
                        <div class="box-body">
                            @if($errors->any())
                                <ul style="width: 87%;" class="alert alert-danger">
                                    @foreach($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            @endif
                            <h2 class=""><strong>{{$item->title}}</strong></h2>
                            <form action="@if($audit){{route('admin.flaw.auditdelay')}}@else{{route('admin.flaw.delay')}}@endif?vuls_id={{$item->id}}" method="post">
                            <ul class="timeline">
                                <li>
                                    <div class="timeline-badge">
                                        <a><i class="fa fa-circle" id=""></i></a>
                                    </div>
                                    <div class="timeline-panel">
                                        <div class="timeline-heading">
                                            <h4 class="">发布漏洞</h4>
                                        </div>
                                        <div class="timeline-body" id="abc">
                                            <p class="">漏洞编号：{{$item->vuls_number}}</p>
                                            <p class="">漏洞价值：{{$item->vlus_value}}元</p>
                                            @if(intval($item->check_id) >0)
                                                <p>检查项：{{$item->checkStr}}</p>
                                            @endif
                                            <p>
                                                创建人：@foreach($users as $user)@if( $user->id == $item->user_id)  {{ $user->real_name }}
                                                ( {{$user->name}} )  @endif @endforeach</p>
                                            <p>副标题：{{$item->description}}</p>
                                            <p>
                                                所属应用：@foreach($apps as $app) @if($app->id  == $item->app_id) {{ $app->name }} @endif @endforeach</p>
                                            <p>
                                                所属分类： @foreach($categorys as $cate) @if( $cate->id == $item->category_id) {{ $cate->name }} @endif @endforeach</p>
                                            <p>
                                                所属级别： @foreach($levels as $level)@if( $level->id == $item->level_id){{ $level->name }} @endif @endforeach</p>
                                            <p>
                                                漏洞状态： @foreach($vulstatus as $vt)@if($vt['id'] == $item->status){{$vt['name']}} @endif  @endforeach</p>
                                            <p>漏洞URL： {{$item->from_url}}</p>
                                            <p>漏洞参数： {{$item->url_parms}}</p>
                                            <p>漏洞负载： {{$item->payload}}</p>
                                            <p>内容：{!!$item->content!!}</p>
                                            <p>参考资料：</p>
                                            <div class="row">
                                                @foreach($item->ref as $ref)
                                                    <div class="col-md-12">
                                                        <a style="padding-left:15px;" target="_blank"
                                                           href="{{route('knowledge.showpage',['id'=>$ref->id])}}">{{mb_substr($ref->title,0,50)}}</a>
                                                    </div>
                                                @endforeach
                                            </div>
                                        </div>
                                        <div class="timeline-footer">
                                            <p class="text-right">{{$item->created_at}}</p>
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <label>延期到：@if(!$audit)<strong style="color: red;">请选择大于修复终止日期{{$item->delay['begin_time']}}</strong>@endif</label>
                                    <input @if($audit) disabled @endif required style="width: 97%;" class="form-control" type="text" id="delayed_at" placeholder="到期时间" name="delayed_at" value="{{$item->delay['delayed_at']}}">
                                </li>
                                @if(!$item->content->isEmpty())
                                @foreach($item->content as $content)
                                <li>
                                    <div class="timeline-badge">
                                        <a><i class="fa fa-circle invert" id=""></i></a>
                                    </div>
                                    <div class="timeline-panel">
                                        <div class="timeline-heading">
                                            <h4>
                                            @if($content->applyer)
                                                {{$content->name}}申请延期
                                            @else
                                                {{$content->name}}审核信息
                                            @endif
                                            </h4>
                                        </div>
                                        <div class="timeline-body">
                                            <p>{{$content->reason}}</p>
                                        </div>
                                        <div class="timeline-footer">
                                            <p class="text-right">{{$content->created_at}}</p>
                                        </div>
                                    </div>
                                </li>
                                @endforeach
                                @endif
                                <li class="form-group">
                                    <label>描述</label>
                                    <textarea class="form-control" maxlength="255" required rows="3"
                                              placeholder="说明原因..." name="reason"></textarea>
                                </li>
                                @if($audit)
                                <li class="form-group">
                                    <input type="radio" name="agree" value="0" title="驳回">驳回
                                    <input type="radio" name="agree" value="1" title="同意">同意
                                </li>
                                @endif
                                <li class="form-group">
                                    <button class="layui-btn layui-btn-warm" type="submit">提交</button>
                                </li>

                                <li class="clearfix no-float"></li>
                            </ul>
                                {{csrf_field()}}
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        @endisset
    </section>


@stop
@section('javascript-end')
    <script src="{{env('APP_ROOT')}}/assets/layui/layui.all.js"></script>
    <script src="{{env('APP_ROOT')}}/js/layertips.js"></script>
    <script>
        $(function(){
            var day = new Date("{{$item->delay['to_begin_time']}}");

            $('#delayed_at').datepicker({
                autoclose: true,
                startDate: day
            });
        });
    </script>
@endsection